package com.cmcc.qx.ws.dao.impl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.stereotype.Repository;

import com.cmcc.qx.common.dao.impl.BaseDaoImpl;
import com.cmcc.qx.common.entity.ObjectType;
import com.cmcc.qx.ws.dao.BackDao;

@Repository("backDaoImpl")
public class BackDaoImpl extends BaseDaoImpl implements BackDao{

	public List<ObjectType> queryNav() {
		String hql = "from ObjectType where objType = ? order by seq ";
		List<Object> list = queryHql(hql,"navigation");
		List<ObjectType> navs = new ArrayList<ObjectType>();
		for (Object obj : list) {
			ObjectType nav = (ObjectType) obj;
			navs.add(nav);
		}
		return navs;
	}

	public ObjectType queryNavById(String id) {
		String hql = "from ObjectType where id = ?";
		ObjectType objType = (ObjectType)queryHql(hql,Integer.valueOf(id)).get(0);
		return objType;
	}

	public void updateNav(ObjectType objType) {
		this.update(objType);
	} 

}
